import { Graph } from "@antv/x6";

export default class X6Util {

    static getGraph(container: HTMLElement) {
        const graph = new Graph({
            // panning: true,
            container,
            grid: true
        });
        return graph;
    }

    static getNodeConfig(title: string) {
        return {
            shape: 'html',
            x: 120,
            y: 50,
            width: 120,
            height: 50,
            html: () => {
                const wrap = document.createElement('div')
                wrap.style.width = '100%'
                wrap.style.height = '100%'
                wrap.style.display = 'flex'
                wrap.style.alignItems = 'center'
                wrap.style.justifyContent = 'center'
                wrap.style.border = '2px solid #9254de'
                wrap.style.background = '#efdbff'
                wrap.style.borderRadius = '4px'
                wrap.innerText = title
                return wrap
            },
        };
    }
}